﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pagebase/Pagelist.Master" AutoEventWireup="true"  EnableEventValidation="false" CodeBehind="S_staffList.aspx.cs" Inherits="webnew.Systems.S_staffList" %>
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>
<%@ Register src="../UserControls/UcCompany.ascx" tagname="UcCompany" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
        $(document).ready(function() {
            $("#<%=UcCompany1.ClientID%>_ddlCompany").change(function() {
                OaCompListChange();
            });
            
        });
        function document.onkeydown() {
            var e = event.srcElement;
            if (event.keyCode == 13) {
                document.getElementById("<%=btnSearch.ClientID%>").click();
                return false;
            }
        }   
        function OaCompListChange() {
            var RegionDdl = document.getElementById('<%=ddlOADept.ClientID %>');
            var selValue = $("#<%=UcCompany1.ClientID%>_ddlCompany").val();
            document.getElementById('<%=txtOADept.ClientID %>').value ="0";
            if (selValue == '00000000-0000-0000-0000-000000000000') {
                while (RegionDdl.options.length > 1) {
                    RegionDdl.remove(1);
                }
                return;
            }
            PageMethods.GetDeptList(selValue, bindOADeptList);
        }

        function bindOADeptList(Result) {
            var lst = Result;
            var RegionDdl = document.getElementById('<%=ddlOADept.ClientID %>');
            while (RegionDdl.options.length > 0) {
                RegionDdl.remove(0);
            }                                
           
            var options = document.createElement("OPTION");
            options.text = "--请选择--";
            options.value = "0";
            RegionDdl.add(options);
            for(var i=0;i<lst.length;i++)
            {
                var opt = document.createElement("OPTION");
                opt.text = lst[i].deptname;
                opt.value = lst[i].Id;
                RegionDdl.add(opt);
            }
        }
        function OaDeptListChange() {          
            var DeptDdl = document.getElementById('<%=ddlOADept.ClientID %>');
            var selValue = DeptDdl.options[DeptDdl.selectedIndex].value;
            document.getElementById('<%=txtOADept.ClientID %>').value = selValue;
        }
    ////////////////////////////////////////////////////////////////////////////////
      
    </script>
 <div id="searchbox">
   <div>
     
        所属单位：<uc1:uccompany ID="UcCompany1" runat="server" />
        所属部门：<asp:DropDownList ID="ddlOADept" runat="server" onchange="OaDeptListChange()" >
        </asp:DropDownList>
       员工姓名：<asp:TextBox ID="txtTrueName" runat="server" CssClass="txt"></asp:TextBox> 职位关键字：<asp:TextBox ID="txtTitleName" runat="server" CssClass="txt" 
            MaxLength="10" Width="150px"></asp:TextBox>
        <asp:Button  ID="btnSearch" runat="server" CssClass="btn" onclick="btnSearch_Click" 
            Text="检索" />                    
    
      </div>
      
        
    
        状态：<asp:DropDownList ID="dllStatus" runat="server">
            <asp:ListItem Value="全部">全部</asp:ListItem>
            <asp:ListItem Value="0">启用</asp:ListItem>
            <asp:ListItem Value="2">停用</asp:ListItem>
        </asp:DropDownList>
    
             <asp:TextBox ID="txtOADept" runat="server" Width="38px">0</asp:TextBox>
         <asp:TextBox ID="txtHRDept" runat="server" Width="38px">0</asp:TextBox>
    </div>
 <asp:UpdatePanel ID="upanlGrdView" runat="server" UpdateMode="Conditional" >
<ContentTemplate>

    <div id="contentbox">
        <asp:GridView ID="grdView" runat="server" AutoGenerateColumns="False" 
            CssClass="dgv"  Width ="98%" DataKeyNames="id" onrowdatabound="grdView_RowDataBound" 
            PageSize="15">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkall" onclick="chkall(this);" runat="server" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkitem"  onclick="chkclick(this);" runat="server" />
                    </ItemTemplate>
                    <ItemStyle Width="10px" />
                </asp:TemplateField>
              
                <asp:BoundField DataField="TrueName" HeaderText="员工姓名"  />
                <asp:BoundField DataField="StaffNO" HeaderText="员工ID"  />
                <asp:BoundField DataField="Sex" HeaderText="性别" />
                <asp:BoundField DataField="OACompName" HeaderText="所属单位" />
                <asp:BoundField DataField="OADeptName" HeaderText="所属部门" />
               
                <asp:BoundField DataField="titleName" HeaderText="职务" >
                   
                </asp:BoundField>
                <asp:BoundField DataField="LeaderName" HeaderText="上级领导" >
                    
                </asp:BoundField>
                <asp:BoundField DataField="remark"  HeaderText="备注"  >
                    
                </asp:BoundField>
                <asp:BoundField DataField="isdel" HeaderText="状态" />               
            </Columns>
             <HeaderStyle CssClass="x-panel-header" />
             <AlternatingRowStyle CssClass="dgvitem1" />
             <RowStyle CssClass="dgvitem" />
        </asp:GridView>
        <div id="footbox">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" 
                CurrentPageButtonClass="cpb" FirstPageText="首页" LastPageText="尾页" 
                NextPageText="后页" PageSize="15" PrevPageText="前页" ShowBoxThreshold="2" 
                onpagechanged="AspNetPager1_PageChanged">
            </webdiyer:AspNetPager>
        </div>
        
</ContentTemplate>
         <Triggers>           
             <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />                        
         </Triggers>

    </asp:UpdatePanel>
    </div>
    <asp:UpdateProgress ID="uproLoad" runat="server" 
        AssociatedUpdatePanelID="upanlGrdView" >

            <ProgressTemplate >

               <div id="loadPic"></div>                   
                 <div  id="loadFont" >数据正在查询,请耐心等待...</div>     
            </ProgressTemplate>

        </asp:UpdateProgress>
        <asp:GridView ID="grdExcel" runat="server" AutoGenerateColumns="False" 
            CssClass="dgv"  Width ="98%" DataKeyNames="id" onrowdatabound="grdExcel_RowDataBound" 
            PageSize="15">
            <Columns>
        
              
                <asp:BoundField DataField="TrueName" HeaderText="员工姓名"  />
                <asp:BoundField DataField="StaffNO" HeaderText="员工ID"  />
                <asp:BoundField DataField="Sex" HeaderText="性别" />
                <asp:BoundField DataField="OACompName" HeaderText="所属单位" />
                <asp:BoundField DataField="OADeptName" HeaderText="所属部门" />
               
                <asp:BoundField DataField="titleName" HeaderText="职务" >
                    <ItemStyle Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="LeaderName" HeaderText="上级领导" >
                    <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="remark"  HeaderText="备注" ItemStyle-Width="200px" >
                    <ItemStyle Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="isdel" HeaderText="状态" />               
            </Columns>
             <HeaderStyle CssClass="x-panel-header" />
             <AlternatingRowStyle CssClass="dgvitem1" />
             <RowStyle CssClass="dgvitem" />
        </asp:GridView>
</asp:Content>
